home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / MSWorks.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  12.8 KB  |  379 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        MSWorks.vu
  5. #
  6. #    Contains:    Quick look test script for Microsoft Works version 3.0
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  19. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  20. #
  21. # ****************************************************************************
  22. #
  23.  
  24.  
  25.  
  26. ########################################################################
  27. #                            External libraries 
  28. #=======================================================================
  29. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","Print.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  30.  
  31.  
  32. #########################################################################
  33. ########               Application Specific Tasks
  34. #########################################################################
  35.  
  36. #########################################################################
  37. #                        InitAppGlobals()
  38. #========================================================================
  39. # Author:        KA
  40. # Description:    Sets up tools and fonts for Microsoft Works    .  This task
  41. #                must be called first.
  42. # Parameters:    None
  43. # Returns:        Nothing
  44. # Examples:        InitAppGlobals()
  45. #========================================================================
  46. # History:
  47. #
  48. ########################################################################
  49. task InitAppGlobals()
  50. begin
  51.     
  52.     logstr("setting up {global gApptitle}'s globals");            
  53.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  54.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  55.     global kToolPaletteNum := 1; 
  56.     global kPatternPaletteNum := 2;
  57.     global kLinePaletteNum := 3;
  58.     global kColorPaletteNum := 4;
  59.     global kGradientPaletteNum := 0;
  60.  
  61.     global gWindowInset := {0,64,20,20};        # Window inset
  62.     global gScreenInset := {0,42,0,0};        # Screen inset
  63.     global gVoidRect := {};                    # Rect not to draw in - coordinates should be RelativeToWindow
  64.     global gTextStr;
  65.     
  66.     global gPaletteList :=    {
  67.                             {                        #### Start Palette # - Draw tools
  68.                             {1, 16},                # Specifier/HeaderHieght
  69.                             kPalWind,                # Palette type
  70.                             {2,12},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  71.                             {30,18}                    # Offset between tools {h,v}
  72.                             },                        #### End Palette #
  73.                             {                        #### Start Palette # - Pattern 
  74.                             {15,190,-255,181,1},    # PopPoint/TopLeft/Windspecifier
  75.                             kPopUpPal,                # Palette type
  76.                             {16,4},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  77.                             {16,16}                    # Offset between tools {h,v}
  78.                             },                        #### End Palette #
  79.                             {                        #### Start Palette # - Line 
  80.                             {52,190,-89,182,1},        # PopPoint/TopLeft/Windspecifier
  81.                             kPopUpPal,                # Palette type
  82.                             {10,10},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  83.                             {13,13}                    # Offset between tools {h,v}
  84.                             },                        #### End Palette #
  85.                             {                        #### Start Palette # - Color
  86.                             {23,209,-319,200,1},    # PopPoint/TopLeft/Windspecifier
  87.                             kPopUpPal,                # Palette type
  88.                             {32,8},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  89.                             {10,10}                    # Offset between tools {h,v}
  90.                             }                        #### End Palette #
  91. };
  92.  
  93.     ### Works                                                                        {Flag, Pattern, Line, Color}
  94.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  95.     global Pointer             :=     { 9,  1,         "Pointer",    kClick,     0,                {0}                };    
  96.     global LineTool         :=     { 10,  1,         "Line",        kDrag,        0,                {1,1,1,1}        };
  97.     global CharTool         :=     { 11,  1,         "Char",        kClick,     0,                {gTextStr}                };
  98.     global ParagraphTool    :=     { 12,  1,        "Paragraph",kDrag,        0,                {gTextStr}                };
  99.     global RndRectTool         :=     { 13,  1,         "RndRect",    kDrag,        0,                {1,1,1,1}                };
  100.     global RectTool         :=     { 14,  1,        "Rect",        kDrag,         0,                {1,1,1,1}                };
  101.     global OvalTool         :=     { 15,  1,         "Oval",        kDrag,        0,                {1,1,1,1}                };
  102.     global MultiLine         :=     { 16,  1,         "MultiLine",kMultiClick,1,                {1,1,1,1}                };
  103.     global ArcTool             :=     { 17,  1,         "Arc",        kDrag,        0,                {1,1,1,1}                };
  104.     global FreeTool         :=     { 18,  1,         "Freehand",    kMultiDrag,    0,                {1,1,1,1}                };
  105.  
  106.     # global Tool list
  107.     global gToolList:={    
  108.                         Pointer, 
  109.                         LineTool,
  110.                         CharTool,
  111.                         ParagraphTool,
  112.                         RndRectTool,
  113.                         RectTool,
  114.                         OvalTool,
  115.                         MultiLine,
  116.                         ArcTool,    
  117.                         FreeTool
  118. };
  119.                         
  120.         ### font characteristic lists
  121.     global gFontSizeList := {'9','10','12','14','18'};
  122.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
  123.  
  124.         ### Name of the Plain (style) menu item  ####
  125.     global gPlainStyle := "Plain";            # Plain-Style menu item
  126.  
  127.         ### How to get to the next line
  128.     global gNextLineMethod := 1;            
  129.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  130.     
  131.         ### Does moving to the next line clear all font info
  132.     global gNextLineClearsFontSettings := 0;
  133.     
  134. end;    #InitAppGlobals
  135.  
  136. #########################################################################
  137. #                        NewWorksDoc()
  138. #========================================================================
  139. # Author:        KTA
  140. # Description:    Select Icon and type return in Works' SF_Get
  141. # Parameters:    None
  142. # Returns:        Nada
  143. # Examples:        NewWorksDoc();
  144. # Assumptions:    Works
  145. #========================================================================
  146. # History:
  147. #
  148. #########################################################################
  149. task NewWorksDoc(whichType, SelectOpen := 0)
  150. begin
  151.     dialogcheck('No terminal tool',1);
  152.     If(SelectOpen)
  153.     begin
  154.         SelectMenuItem('Open','File');
  155.         Wait(2);
  156.     end;
  157.     
  158.     if(match[button t:'Desktop'])
  159.     begin
  160.         AllTypes := {56,51};
  161.         WordProcessor := {123,51};
  162.         DataBase := {177,51};
  163.         SpreadSheet := {230,51};
  164.         
  165.         
  166.         if (whichType = 'AllTypes')
  167.             moveRelativeToWindow(AllTypes[1],AllTypes[2],1,2,0,1);
  168.         else if (whichType = 'WordProcessor')
  169.             moveRelativeToWindow(WordProcessor[1],WordProcessor[2],1,2,0,1);
  170.         else if (whichType = 'DataBase')
  171.             moveRelativeToWindow(DataBase[1],DataBase[2],1,2,0,1);
  172.         else if (whichType = 'SpreadSheet')
  173.             moveRelativeToWindow(SpreadSheet[1],SpreadSheet[2],1,2,0,1);
  174.             
  175.         LogStr("Selected the ∂'{whichType}∂' icon on Works∂' StandardFiled dialog");
  176.         #SelectButton('New');
  177.         SpecialKey(returnkey,'Return key');
  178.     end;
  179.     else
  180.         Println "Sorry, but Works' StandardFile is not present";
  181. end;
  182.  
  183.     
  184. #########################################################################
  185. #                            NumberCalc()
  186. #========================================================================
  187. # Author:        KTA
  188. # Description:    Enters in a numbers to be used in a simple speadsheet 
  189. #                calculation.
  190. # Parameters:    None
  191. # Returns:        Nothing
  192. # Examples:        NumberCalc();
  193. # Assumptions:    None 
  194. #========================================================================
  195. # History:
  196. #
  197. #########################################################################
  198. task NumberCalc() begin
  199.     numbersList :={"=sum(b2:b6)",40,30,20,10,1000};
  200.     SpecialKey( rightarrowkey, "RightArrow Key");
  201.     TypeList(NumbersList,4,1);
  202. end;
  203.  
  204. #########################################################################
  205. #                            TextLabels()
  206. #========================================================================
  207. # Author:        KTA
  208. # Description:    Enters in a Labels to be used in a simple speadsheet 
  209. #                calculation.
  210. # Parameters:    None
  211. # Returns:        Nothing
  212. # Examples:        TextLabels();
  213. # Assumptions:    None 
  214. #========================================================================
  215. # History:
  216. #
  217. #########################################################################
  218. task TextLabels() begin
  219.     textList :={"Quarterly Earnings","Mortgage", "Paper", "Utilities", "Garbage", 'Phone', 'Total'};
  220.     TypeList(textList,1);
  221. end;
  222.  
  223.  
  224. #########################################################################
  225. #                            WorkSSEx()
  226. #========================================================================
  227. # Author:        KTA
  228. # Description:    Sets up a  simple speadsheet calculation test.
  229. # Parameters:    None
  230. # Returns:        Nothing
  231. # Examples:        WorkSSEx();
  232. # Assumptions:    None 
  233. #========================================================================
  234. # History:
  235. #
  236. #########################################################################
  237. task WorkSSEx() begin
  238.     LogStr("Begining data entry for Work Spreadsheet example",3);
  239.     NewWorksDoc('SpreadSheet',1);
  240.     
  241.     TextLabels();
  242.     NumberCalc();
  243.     LogStr("Entered some data and performed a calculation",3);
  244.     println;
  245. end;
  246. #########################################################################
  247. #                            DBSetup()
  248. #========================================================================
  249. # Author:        KTA
  250. # Description:    Enters Field names into Works DateBase
  251. # Parameters:    none
  252. # Returns:        Nothing
  253. # Examples:        DBSetup();
  254. # Assumptions:    None 
  255. #========================================================================
  256. # History:
  257. #
  258. #########################################################################
  259. task DBSetup() 
  260. begin
  261.     TypeList({'Name', 'Address', 'City', 'State', 'Zip', 'Phone', 'Birth Date'},1,1); # Each item followed by a returnkey
  262.  
  263.     selectButton('Done');
  264.     println;
  265. end;
  266. #########################################################################
  267. #                            WorkDBEx()
  268. #========================================================================
  269. # Author:        KTA
  270. # Description:    Sets up a DB example
  271. # Parameters:    none
  272. # Returns:        Nothing
  273. # Examples:        WorkDBEx();
  274. # Assumptions:    None 
  275. #========================================================================
  276. # History:
  277. #
  278. #########################################################################
  279. task WorkDBEx()
  280. begin
  281.     NewWorksDoc('DataBase',1);
  282.     DBSetup();    
  283.     DataEntry();
  284.     CloseWindow(1);
  285. End;
  286.  
  287. #########################################################################
  288. #                            DataEntry()
  289. #========================================================================
  290. # Author:        KTA
  291. # Description:    Enters Data into Works DateBase
  292. # Parameters:    none
  293. # Returns:        Nothing
  294. # Examples:        DataEntry();
  295. # Assumptions:    None 
  296. #========================================================================
  297. # History:
  298. #
  299. #########################################################################
  300. task DataEntry() 
  301. begin
  302.     selectMenuItem("List View","Form");        #change to list view
  303.     
  304.     JohnList := {'John Doe','25 Main St.','San Francisco','CA','95168','657-9876','10-14-58'};
  305.     CalvinList := {'Calvin Hobbes','15680 Beach Blvd.','Santa Cruz','CA','95647','756-6453','03-17-61'};
  306.     WillList := {'Will Clark','1280 Broadway ','Candlestick Park','CA','95637','213-7645','02-11-65'};
  307.     BruceList:= {'Bruce Wayne', '110 First St','Gotham City', 'NJ', '952145', '(423) 456-4675', '09-05-66'};
  308.  
  309.     DataList :={JohnList, CalvinList, WillList, BruceList};
  310.     
  311.     for each item in DataList 
  312.         TypeList(item,2,1);
  313.  
  314.     println;
  315. end;
  316.  
  317. #########################################################################
  318. #                            PageSetupWorks()
  319. #========================================================================
  320. # Author:        ML
  321. # Description:    Custom Page Setup for Works
  322. # Parameters:    none
  323. # Returns:        Nothing
  324. # Examples:        PageSetupWorks();
  325. # Assumptions:    None 
  326. #========================================================================
  327. # History:
  328. #
  329. ########################################################################
  330. task PageSetupWorks() 
  331. begin
  332.     PageSetup();
  333.     dialogcheck("The width",1);    # handle Works warning if doc width greater than
  334.                                 # print width
  335. end;
  336.  
  337. ################################################################################
  338. ####################             Main script                    ####################
  339. ################################################################################
  340. script Works (ScriptLevel:= -1)
  341. begin
  342.     InitGlobals(ScriptLevel);            # initialize your general globals
  343.     InitDraw();
  344.     InitFonts();
  345.     global gApptitle := "Microsoft Works";
  346.     global gAppVersion := '3';        # version of app you will be running
  347.     SuiteStart('MSWorks.vu');                    # begin a new test suite
  348.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  349.     begin
  350.         global gFileName := "@!@-{gBuildVers}-Works";
  351.         InitAppGlobals();                                    # init app specific globals
  352.         (*
  353.         *)
  354.         NewWorksDoc('WordProcessor');            # WordProcessor
  355.         DoSetUpApp(,,,1,1,1);
  356.         DoText();            
  357.         
  358.         SelectMenuItem('Draw On', 'Window');    # Drawing
  359.         DoDraw();
  360.         SelectMenuItem('Save','File');
  361.         SelectMenuItem('Hide Tools', 'Window');
  362.         
  363.         WorkSSEx();                            # SpreadSheet
  364.         DoWindow();
  365.         CloseWindow(1);
  366.         
  367.         WorkDBEx();                            # DataBase
  368.         
  369.         PageSetupWorks();
  370.         DoCloseApp(0,,0);                      
  371.  
  372.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  373.     SuiteEnd();
  374. end;    #    script Works
  375.  
  376. ## Still needed
  377. # 1) A dialog comes up at the first launch (Comm not avail). need - Communication dialogCheck
  378.  
  379.